subconjuntos::[a] -> [[a]]
subconjuntos [] = [[]]
subconjuntos (x:xs) = [x:ys|ys <- sub] ++ sub
	where sub = subconjuntos xs

interleave:: a -> [a] -> [[a]]
interleave x [] = [[x]]
interleave x (y:ys) = (x:(y:ys)):rs
	where rs = map (\xs -> y:xs) is
              is = interleave x ys

perms:: [a] -> [[a]]
perms [x] = [[x]]
perms (x:xs) = concat (map (interleave x) (perms xs))

slowSort:: (Ord a) => [a] -> [a]
slowSort xs = (filter (ordenado) (perms(xs)))!!0

ordenado:: (Ord a) => [a] -> Bool
ordenado [] = True
ordenado [x] = True
ordenado (x:y:ys) = (x <= y) && (ordenado(y:ys))
